﻿using UnityEngine;
using System.Collections;
namespace UnityEditor.Extension
{
    public class PropertyIndexer
    {
        SerializedProperty m_property;
        public SerializedProperty property { get { return m_property; } }
        public void Update()
        {
            property.serializedObject.Update();
        }

        public void ApplyModifiedProperties()
        {
            property.serializedObject.ApplyModifiedProperties();
        }

        public UnityEngine.Object target { get { return m_property.serializedObject.targetObject; } }

        public PropertyIndexer(SerializedProperty property)
        {
            m_property = property;
        }

        public SerializedProperty this[string index]
        {
            get
            {
                return property.FindPropertyRelative(index);
            }
        }
    }

}